﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RenChangYou.Common;

namespace DaoYou.Web
{
    public partial class Search : System.Web.UI.Page
    {
        protected List<RenChangYou.Model.DY_User> SearchResult { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            //string Province = Request["ctl00$MainContent$ddlProvince"];
            //string City = Request["ctl00$MainContent$ddlCity"];
            //string Area = Request["ctl00$MainContent$ddlArea"];
            string Keyword = this.txtKeyword.Value;

            string where = " UserType = '1' ";

            if (!string.IsNullOrWhiteSpace(Keyword))
            {
                where += string.Format(" and ( Province = '{0}' or City = '{0}' ) ", Keyword);
            }

            //if (!string.IsNullOrWhiteSpace(Province))
            //{
            //    where += string.Format(" and Province = '{0}' ", Province);
            //}
            //if (!string.IsNullOrWhiteSpace(City))
            //{
            //    where += string.Format(" and City = '{0}' ", City);
            //}
            //if (!string.IsNullOrWhiteSpace(Area))
            //{
            //    where += string.Format(" and District = '{0}' ", Area);
            //}

            RenChangYou.BLL.DY_User bllUser = new RenChangYou.BLL.DY_User();

            this.SearchResult = bllUser.GetModelList(where);

        }

        protected string GetUserIntroduction(string UserName)
        {
            RenChangYou.BLL.DY_GuideIntroduction bll = new RenChangYou.BLL.DY_GuideIntroduction();
            RenChangYou.Model.DY_GuideIntroduction model = bll.GetModelByCache(UserName);

            if (model != null)
            {
                return StringPlus.NoHTML(model.Introduction);
            }

            return string.Empty;
        }
    }
}